home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / games / pundit.zip / PUNDIT.C next >
C/C++ Source or Header  |  1990-11-29  |  23KB  |  521 lines

  1. /*
  2.  *  Pundit.c
  3.  *      Source for Pundit
  4.  *
  5.  *  Author:         Jeff Bienstadt
  6.  *
  7.  *  Environment:
  8.  *
  9.  *      Run-Time:   Microsoft Windows 3.0
  10.  *
  11.  *      Compilers/Tools:
  12.  *                  Microsoft C 6.0
  13.  *                  Microsoft Windows SDK 3.0
  14.  *
  15.  */
  16.  
  17. #include    <windows.h>     // All the Windows goodies
  18. #include    <stdlib.h>      // for rand() and srand()
  19. #include    <stdio.h>       // for sprintf()
  20. #include    <time.h>        // for time()
  21. #include    "pundit.h"      // constants for Pundit
  22.  
  23. //  The structure for all the settings
  24. typedef struct _settings {
  25.     int         insecs,     // time window is shown (in seconds)
  26.                 outsecs,    // time window is gone  (in seconds)
  27.                 x,          // X position of window (in device units)
  28.                 y,          // Y position of window (in device units)
  29.                 width,      // width of window      (in device units)
  30.                 height;     // height of window     (in device units)
  31. } SETTINGS;
  32.  
  33. //  Function Prototypes
  34. long FAR PASCAL     WndProc(HWND, WORD, WORD, LONG);
  35. BOOL FAR PASCAL     Settings(HWND, unsigned, WORD, LONG);
  36. BOOL FAR PASCAL     About(HWND, unsigned, WORD, LONG);
  37. void                FetchSettings(void);
  38. void                SaveSettings(HWND);
  39. void                InitSettings(HWND);
  40. void                InitGlobals(HANDLE);
  41.  
  42.  
  43. //  Global variables
  44. int     count;          // counts seconds window is hidden/visible
  45.  
  46. WORD    string_number;  // store ID from string table here
  47.  
  48. BOOL    inout_state,    // are we shown or hidden?
  49.         paused;         // ...... paused or couning?
  50.  
  51. HANDLE  hinst;          // a global Instance Handle
  52.  
  53. HWND    jkbPundit;      // a global Window Handle (for main window)
  54.  
  55. SETTINGS    settings;   // the settings structure
  56.  
  57. char    szAppName[] = "jkbPundit";  // The (internal) Application Name
  58.  
  59.  
  60. //  The main Window Procedure
  61. int PASCAL WinMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
  62. HANDLE  hInstance,      // Instance Handle
  63.         hPrevInstance;  // Previous Instance Handle
  64. LPSTR   lpszCmdLine;    // The Command Line (we don't use it here)
  65. int     nCmdShow;       // The SHOW Method  (we don't use this, either)
  66. {
  67.     MSG             msg;        // a place to store Windows' Messages
  68.     WNDCLASS        wndclass;   // a Window Class structure
  69.  
  70.     //  If we have NOT already defined our Window Class, do so now...
  71.     //  (see the SDK documentation for how this works)
  72.     if (!hPrevInstance) {
  73.         wndclass.style          = CS_HREDRAW | CS_VREDRAW;
  74.         wndclass.lpfnWndProc    = WndProc;
  75.         wndclass.cbClsExtra     = 0;
  76. //        wndclass.cbWndExtra     = DLGWINDOWEXTRA;
  77.         wndclass.cbWndExtra     = 0;
  78.         wndclass.hInstance      = hInstance;
  79.         wndclass.hIcon          = LoadIcon(hInstance, szAppName);
  80.         wndclass.hCursor        = LoadCursor(NULL, IDC_ARROW);
  81.         wndclass.hbrBackground  = COLOR_WINDOW+1;
  82.         wndclass.lpszMenuName   = szAppName;
  83.         wndclass.lpszClassName  = szAppName;
  84.  
  85.         RegisterClass(&wndclass);   // Register the Window Class
  86.     }
  87.  
  88.     InitGlobals(hInstance);     // Initialize Global Varaibles;
  89.  
  90.     // Create the Window, and put it's handle into our global Window Handle
  91.     jkbPundit = CreateWindow(szAppName,              // Window Name
  92.                              "Pundit: "
  93.                              "Quote of the Moment",  // Window Caption
  94.                              WS_OVERLAPPED |         // an Overlapped Window...
  95.                                  WS_CAPTION |        //    with a Caption,
  96.                                  WS_THICKFRAME |     //    a Sizeable Frame,
  97.                                  WS_SYSMENU,         //    and a System Menu
  98.                              settings.x,             // X position of Window
  99.                              settings.y,             // Y position of Window
  100.                              settings.width,         // Width of Window
  101.                              settings.height,        // Height of Window
  102.                              NULL,                   // No Parent
  103.                              NULL,                   // Use the Class menu
  104.                              hInstance,              // Instance for Window
  105.                              NULL);                  // No additional params
  106.  
  107.     //  Try to get a timer... keep trying until we get one or the user gives up
  108.     while (!SetTimer(jkbPundit, ID_TIMER, 1000, NULL)) {
  109.         if (IDCANCEL == MessageBox(jkbPundit,
  110.                                    "I need a Timer, but Windows won't lemme"
  111.                                         "have one\012"
  112.                                         "(maybe you could close a clock"
  113.                                         "or something...)",
  114.                                    szAppName,
  115.                                    MB_ICONEXCLAMATION | MB_RETRYCANCEL))
  116.             return FALSE;   // User gave up, bail out
  117.     }
  118.  
  119.     ShowWindow(jkbPundit, SW_SHOWNORMAL);   // Display our Window
  120.     UpdateWindow(jkbPundit);                // Update our Window
  121.     while (GetMessage(&msg, NULL, 0, 0)) {  // Fetch a Message from Windows
  122.         TranslateMessage(&msg);     // Translate Keyboard Messages
  123.         DispatchMessage(&msg);      // Pass Message on to our callback function
  124.     }                           // until we get a QUIT Message
  125.     return msg.wParam;          // return to Windows
  126. }   // end of WinMain
  127.  
  128.  
  129. //  Initialize Global Variables
  130. void InitGlobals(hInstance)
  131. HANDLE  hInstance;  // our Instance Handle
  132. {
  133.     time_t          ltime;      // here we store the system time
  134.  
  135.     settings.insecs  =   5;     // "Default" IN seconds
  136.     settings.outsecs =  20;     // "Default" OUT seconds
  137.     settings.x       =   1;     // "Default" X position
  138.     settings.y       =   1;     // "Default" Y position
  139.     settings.width   = 250;     // "Default" Width
  140.     settings.height  = 150;     // "Default" Height
  141.     FetchSettings();            // Now read settings from WIN.INI
  142.  
  143.     count            =   0;     // Zero out the counter
  144.     paused           = FALSE;   // We're not paused yet
  145.     inout_state      = TRUE;    // We're in the "show" state
  146.     hinst            = hInstance;   // Save our current Instance
  147.  
  148.     time(<ime);               // Get the current time
  149.     srand((unsigned)ltime);     // Use it to set the random number "seed"
  150.     // Create the first string table ID
  151.     string_number    = (rand() % MAX_STRING) + 1;
  152. }
  153.  
  154.  
  155. //  Our main Window ``callback'' function
  156. long FAR PASCAL WndProc(hwnd, message, wParam, lParam)
  157. HWND    hwnd;       // Window Handle for our Window
  158. WORD    message,    // The Window's Message
  159.         wParam;     // The WORD parameter value
  160. LONG    lParam;     // The LONG parameter value
  161. {
  162.     PAINTSTRUCT     ps;     // a Paint structure (for painting the Window)
  163.     HDC             hdc;    // a Display Context Handle (for writing text)
  164.     RECT            rect;   // a Rectangle structure (for writing text)
  165.     FARPROC         lpProcAbout,    // Pointer to function for "About" dialog
  166.                     lpSettingsDialog;   //.................."Settings" dialog
  167.     char            str_buffer[256];    // buffer for string from string table
  168.  
  169.     switch (message) {      // check for messages...
  170.     case    WM_INITMENU:        // if a Menu is displayed...
  171.         SendMessage(hwnd, WM_jkb_PAUSE, 0, 0L); // ...stop the timer
  172.         break;
  173.  
  174.     case    WM_MENUSELECT:      // if a Menu has been canceled...
  175.         if ((LOWORD(lParam) == 0xFFFF) && (HIWORD(lParam) == 0))
  176.             SendMessage(hwnd, WM_jkb_START, 0, 0L); // ...restart the timer
  177.         break;
  178.  
  179.     case    WM_COMMAND:         // we got a Menu choice...
  180.         switch (wParam) {       // ... which one?
  181.         case    IDM_ABOUT:          // About Pundit...
  182.         // Make a function Instance
  183.             lpProcAbout = MakeProcInstance(About, hinst);
  184.         // Process the "About" dialog box
  185.             DialogBox(hinst, "ABOUTBOX", hwnd, lpProcAbout);
  186.         // Give back the function Instance
  187.             FreeProcInstance(lpProcAbout);
  188.         // Restart the timer
  189.             SendMessage(hwnd, WM_jkb_START, 0, 0L);
  190.             break;
  191.  
  192.         case    IDM_SETTINGS:       // Settings...
  193.         // Make a function Instance
  194.             lpSettingsDialog = MakeProcInstance(Settings, hinst);
  195.         // Process the "About" dialog box
  196.             DialogBox(hinst, "SETTINGS", hwnd, lpSettingsDialog);
  197.         // Give back the function Instance
  198.             FreeProcInstance(lpSettingsDialog);
  199.         // Restart the timer
  200.             SendMessage(hwnd, WM_jkb_START, 0, 0L);
  201.             break;
  202.  
  203.         case    IDM_EXIT:           // Exit
  204.         // Tell Windows to shut down this Application
  205.             PostMessage(hwnd, WM_CLOSE, 0, 0L);
  206.             break;
  207.         }
  208.         return 0L;  // return 0 exit code
  209.  
  210.     case    WM_TIMER:           // We got a TIMER Message
  211.         switch (inout_state) {      // are we visible or hidden?
  212.         case    FALSE:              // hidden...
  213.             if (count >= settings.outsecs) {  // if it's time to show up
  214.                     // create a new string table ID
  215.                 string_number = (rand() % MAX_STRING) + 1;
  216.                 ShowWindow(hwnd, SW_SHOW);          // Show ourselves
  217.                    // Tell Windows that we want to paint the entire client area
  218.                 InvalidateRect(hwnd, NULL, TRUE);
  219.                 UpdateWindow(hwnd);                 // Update the window
  220.                 inout_state = TRUE;                 // switch the state
  221.                 count = 0;                          // reset the counter
  222.             }
  223.             else        // still waiting to show up
  224.                 ++count;        // bump the counter
  225.             break;
  226.         case    TRUE:               // shown...
  227.             if (count >= settings.insecs) {  // if it's time to sleep
  228.                 ShowWindow(hwnd, SW_HIDE);      // hide
  229.                 inout_state = FALSE;            // switch the state
  230.                 count = 0;                      // reset the counter
  231.             }
  232.             else        // still waiting to sleep
  233.                 ++count;        // bump the counter
  234.             break;
  235.         }
  236.         return 0L;
  237.  
  238.     case    WM_PAINT:           // We got a PAINT Message
  239.         GetClientRect(hwnd, &rect);  // Get the dimensions of the client area
  240.             // Fetch a new string from the string table
  241.         LoadString(hinst, string_number, str_buffer, 256);
  242.             // Tell Windows we are ready to paint
  243.             // and get a Display Context Handle
  244.         hdc = BeginPaint(hwnd, &ps);
  245.             // Set Background Color to Windows' Background Color
  246.         SetBkColor(hdc, GetSysColor(COLOR_WINDOW));
  247.             // Set Text Color to Windows' Text Color
  248.         SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
  249.             // Write the new quote
  250.         DrawText(hdc,               // our Display Context Handle
  251.                 (LPSTR)str_buffer,  // our new Quote String
  252.                 -1,                 // let Windows figure the length
  253.                 &rect,              // write into entire client area rectangle
  254.                 DT_LEFT |           // left-justified,
  255.                     DT_NOPREFIX |   // `&' character are not special
  256.                     DT_WORDBREAK);  // let Windows handle word-wrap
  257.         EndPaint(hwnd, &ps);    // Tell Windows that we're done painting
  258.         return 0L;
  259.  
  260.     //  These next two Messages are our own messages, NOT Windows'
  261.     case    WM_jkb_PAUSE:       // We need to shut down the timer
  262.         if (paused == FALSE)            // are we already shut down?
  263.             KillTimer(hwnd, ID_TIMER);  // no, shut it down
  264.         paused = TRUE;                  // and keep track of that fact
  265.         return 0L;
  266.  
  267.     case    WM_jkb_START:       // We need to restart the timer
  268.         if (paused == TRUE)             // are we shut down now?
  269.             SetTimer(hwnd, ID_TIMER, 1000, NULL);   // yes, set timer for 1 sec.
  270.         paused = FALSE;                 // and keep track of that fact
  271.         return 0L;
  272.  
  273.     case    WM_DESTROY:         //  We got a DESTROY Message
  274.         KillTimer(hwnd, ID_TIMER);  // Shut down the timer
  275.         PostQuitMessage(0);         // Post a QUIT Message
  276.         return 0L;
  277.     }
  278.         // We don't need to handle any other messages, but
  279.         // Windows might, so let it see them
  280.     return DefWindowProc(hwnd, message, wParam, lParam);
  281. }   // end of WndProc
  282.  
  283.  
  284. //  About Box manager function
  285. BOOL FAR PASCAL About(hDlg, message, wParam, lParam)
  286. HWND        hDlg;       // Window Handle for our Dialog Box
  287. unsigned    message;    // The Window's Message
  288. WORD        wParam;     // The WORD parameter value
  289. LONG        lParam;     // The LONG parameter value
  290. {
  291.     switch (message) {      // check for messages...
  292.     case    WM_INITDIALOG:      // If the Dialog is just starting...
  293.         PostMessage(jkbPundit, WM_jkb_PAUSE, 0, 0L);  // shut down the timer
  294.         return TRUE;
  295.  
  296.     case    WM_COMMAND:     // We got a COMMAND
  297.             // if the Dialog's button was pressed
  298.         if (wParam == IDOK || wParam == IDCANCEL) {
  299.             EndDialog(hDlg, TRUE);  // That's the end of the Dialog
  300.             return TRUE;            // Say that we processed this message
  301.         }
  302.         break;
  303.     }
  304.     return FALSE;       // Say that we did NOT process the message
  305. }
  306.  
  307.  
  308. HWND    hInScroll,      // Handle for IN scrollbar
  309.         hOutScroll;     // Handle for OUT scrollbar
  310.  
  311. SETTINGS    s;          // a temporary values for settings
  312.  
  313. BOOL FAR PASCAL Settings(hDlg, message, wParam, lParam)
  314. HWND        hDlg;       // Window Handle for our Dialog Box
  315. unsigned    message;    // The Window's Message
  316. WORD        wParam;     // The WORD parameter value
  317. LONG        lParam;     // The LONG parameter value
  318. {
  319.     HWND    hsb;        // Handle for a Horizontal Scroll Bar
  320.     char    temp[10];   // string to write "numbers" into
  321.  
  322.     switch (message) {      // check for messages...
  323.     case    WM_INITDIALOG:      // If the Dialog is just starting...
  324.         PostMessage(jkbPundit, WM_jkb_PAUSE, 0, 0L); // shut down the timer
  325.         InitSettings(hDlg);     // Initialize the Settings Dialog
  326.         return TRUE;
  327.  
  328.     case    WM_HSCROLL:         // We got a Horizontal Scroll Bar Message...
  329.         if (hsb = HIWORD(lParam)) { // if it's not zero
  330.             if (hsb == hInScroll) {     // If it's from the IN Scroll Bar
  331.                 switch (wParam) {       // find out what happened...
  332.                 case    SB_PAGEUP:          // User did a PAGE UP
  333.                     settings.insecs -= 4;   // take off 4 seconds and...
  334.                 case    SB_LINEUP:          // User did a LINE UP
  335.                         // take off 1 second or set to 1, whichever is greater
  336.                     settings.insecs = max(1, settings.insecs-1);
  337.                     break;
  338.                 case    SB_PAGEDOWN:        // User did a PAGE DOWN
  339.                     settings.insecs += 4;   // add 4 seconds and...
  340.                 case    SB_LINEDOWN:        // User did a LINE DOWN
  341.                         // add 1 second or set to 1 minute, whichever is lesser
  342.                     settings.insecs = min(MAX_IN, settings.insecs+1);
  343.                     break;
  344.                 case    SB_TOP:             // User went to the TOP
  345.                     settings.insecs = 1;    // set to 1 second
  346.                     break;
  347.                 case    SB_BOTTOM:          // User went the to BOTTOM
  348.                     settings.insecs = MAX_IN;   // set to 1 minute
  349.                     break;
  350.                 case    SB_THUMBPOSITION:   // User moved...
  351.                 case    SB_THUMBTRACK:      // or is moving the THUMB BUTTON
  352.                         // Windows tells us how far...
  353.                     settings.insecs = LOWORD(lParam);
  354.                 default:
  355.                     break;
  356.                 }
  357.                 // Put the new value into a string
  358.                 sprintf(temp, "%4d", settings.insecs);
  359.                 // Display it in the box next to the Scroll Bar
  360.                 SetDlgItemText(hDlg, IDC_INSECS, temp);
  361.                 // Set the new Scroll Bar position
  362.                 SetScrollPos(hsb, SB_CTL, settings.insecs, TRUE);
  363.             }
  364.             else if (hsb == hOutScroll) {   // If it's from the OUT Scroll Bar
  365.                 switch (wParam) {       // find out what happened...
  366.                 case    SB_PAGEUP:          // User did a PAGE UP
  367.                     settings.outsecs -= 559;   // take off 10 min and...
  368.                 case    SB_LINEUP:          // User did a LINE UP
  369.                         // take off 1 second or set to 1, whichever is greater
  370.                     settings.outsecs = max(1, settings.outsecs-1);
  371.                     break;
  372.                 case    SB_PAGEDOWN:        // User did a PAGE DOWN
  373.                     settings.outsecs += 559;   // add 10 min and...
  374.                 case    SB_LINEDOWN:        // User did a LINE DOWN
  375.                         // add 1 second or set to 1 hour, whichever is lesser
  376.                     settings.outsecs = min(MAX_OUT, settings.outsecs+1);
  377.                     break;
  378.                 case    SB_TOP:             // User went to the TOP
  379.                     settings.outsecs = 1;    // set to 1 second
  380.                     break;
  381.                 case    SB_BOTTOM:          // User went the to BOTTOM
  382.                     settings.outsecs = MAX_IN;   // set to 1 hour
  383.                     break;
  384.                 case    SB_THUMBPOSITION:   // User moved...
  385.                 case    SB_THUMBTRACK:      // or is moving the THUMB BUTTON
  386.                         // Windows tells us how far...
  387.                     settings.outsecs = LOWORD(lParam);
  388.                 default:
  389.                     break;
  390.                 }
  391.                 // Put the new value into a string
  392.                 sprintf(temp, "%4d", settings.outsecs);
  393.                 // Display it in the box next to the Scroll Bar
  394.                 SetDlgItemText(hDlg, IDC_OUTSECS, temp);
  395.                 // Set the new Scroll Bar position
  396.                 SetScrollPos(hsb, SB_CTL, settings.outsecs, TRUE);
  397.             }
  398.         }
  399.         return TRUE;
  400.  
  401.     case    WM_COMMAND:         // One of the Buttons got pressed
  402.         switch (wParam) {           // which one?
  403.         case    IDC_SAVE:           // Save Settings
  404.             SaveSettings(hDlg);     // Save the Settings
  405.             break;
  406.  
  407.         case    IDCANCEL:           // CANCEL
  408.             settings = s;           // Restore setting to what they were
  409.  
  410.         case    IDOK:               // OK
  411.             EndDialog(hDlg, TRUE);  // we're done
  412.             return TRUE;
  413.  
  414.         default:
  415.             break;
  416.         }
  417.         break;
  418.     }
  419.     return FALSE;       // Say that we did NOT process the message
  420. }
  421.  
  422.  
  423. //  Retrieve WIN.INI settings for Pundit
  424. void FetchSettings(void)
  425. {
  426.     //  Here we get each of the 6 settings values
  427.     //  from WIN.INI
  428.     settings.insecs = GetProfileInt((LPSTR)szAppName, (LPSTR)"InSecs",
  429.                                     settings.insecs);
  430.     settings.outsecs = GetProfileInt((LPSTR)szAppName, (LPSTR)"OutSecs",
  431.                                     settings.outsecs);
  432.     settings.x = GetProfileInt((LPSTR)szAppName, (LPSTR)"X",
  433.                                     settings.x);
  434.     settings.y = GetProfileInt((LPSTR)szAppName, (LPSTR)"Y",
  435.                                     settings.y);
  436.     settings.width = GetProfileInt((LPSTR)szAppName, (LPSTR)"Width",
  437.                                     settings.width);
  438.     settings.height = GetProfileInt((LPSTR)szAppName, (LPSTR)"Height",
  439.                                     settings.height);
  440. }
  441.  
  442.  
  443. //  Save the Settings (from Settings Dialog)
  444. void SaveSettings(hDlg)
  445. HWND        hDlg;
  446. {
  447.     char    buf[10];            // a string to write "numbers" into
  448.     int     save_size = FALSE;  // flag to save Window size/position
  449.     RECT    rect;               // boundaries of entire Window
  450.  
  451.     //  write the IN seconds
  452.     sprintf(buf, "%d", settings.insecs);
  453.     WriteProfileString((LPSTR)szAppName, (LPSTR)"InSecs", (LPSTR)buf);
  454.  
  455.     //  write the OUT seconds
  456.     sprintf(buf, "%d", settings.outsecs);
  457.     WriteProfileString((LPSTR)szAppName, (LPSTR)"OutSecs", (LPSTR)buf);
  458.  
  459.     //  Ask user if we should save position and size
  460.     save_size = MessageBox(hDlg,
  461.                            (LPSTR)"Save Current Window Position and Size?",
  462.                            (LPSTR)"Saving",
  463.                            MB_ICONQUESTION | MB_YESNO);
  464.     if (save_size == IDYES) {   // User answered "YES"
  465.         // Ask Windows for size of entire window
  466.         GetWindowRect(jkbPundit, (LPRECT)&rect);
  467.         settings.x      = rect.left;                // X position
  468.         settings.y      = rect.top;                 // Y position
  469.         settings.width  = rect.right - rect.left;   // Width
  470.         settings.height = rect.bottom - rect.top;   // Height
  471.  
  472.         //  write the X position
  473.         sprintf(buf, "%d", settings.x);
  474.         WriteProfileString((LPSTR)szAppName, (LPSTR)"X", (LPSTR)buf);
  475.  
  476.         //  write the Y position
  477.         sprintf(buf, "%d", settings.y);
  478.         WriteProfileString((LPSTR)szAppName, (LPSTR)"Y", (LPSTR)buf);
  479.  
  480.         //  write the Width
  481.         sprintf(buf, "%d", settings.width);
  482.         WriteProfileString((LPSTR)szAppName, (LPSTR)"Width", (LPSTR)buf);
  483.  
  484.         //  write the Height
  485.         sprintf(buf, "%d", settings.height);
  486.         WriteProfileString((LPSTR)szAppName, (LPSTR)"Height", (LPSTR)buf);
  487.     }
  488. }
  489.  
  490.  
  491. //  Initialize Settings Dialog info
  492. void InitSettings(hDlg)
  493. HWND    hDlg;
  494. {
  495.     char    temp[10];   // a string to write "numbers" into
  496.  
  497.     s = settings;       // stash the current settings (in case of CANCEL)
  498.  
  499.     //  Write the current IN seconds in the box next to the Scroll Bar
  500.     sprintf(temp, "%4d", settings.insecs);
  501.     SetDlgItemText(hDlg, IDC_INSECS, temp);
  502.  
  503.     //  Write the current OUT seconds in the box next to the Scroll Bar
  504.     sprintf(temp, "%4d", settings.outsecs);
  505.     SetDlgItemText(hDlg, IDC_OUTSECS, temp);
  506.  
  507.     //  Get handles to each of the 2 Scroll Bar Controls
  508.     hInScroll  = GetDlgItem(hDlg, IDC_INSCROLL);
  509.     hOutScroll = GetDlgItem(hDlg, IDC_OUTSCROLL);
  510.  
  511.     //  Set the Scroll Bar Ranges
  512.     SetScrollRange(hInScroll,  SB_CTL, 1, MAX_IN,  TRUE);
  513.     SetScrollRange(hOutScroll, SB_CTL, 1, MAX_OUT, TRUE);
  514.  
  515.     //  Set the Scroll Bar Positions
  516.     SetScrollPos(hInScroll,  SB_CTL, settings.insecs,  TRUE);
  517.     SetScrollPos(hOutScroll, SB_CTL, settings.outsecs, TRUE);
  518. }
  519.  
  520.  
  521.